<template>
	<view>
		我的订单页面{{userId}}
		<block v-for="(item,i) in orderList" :key="i">
			<view>商品:{{item.goods===null ? '商品丢失,请联系客服' : item.goods}}</view>
			<view>收货地址{{item.consignee_addr}}</view>
			<view>商品总价:{{item.order_price}}</view>
		</block>
	</view>
</template>

<script>
	export default {
		props: {
			userInfo: {
				type: Object,
				default: {}
			},
			userId: {
				type: String,
				default: ''
			}

		},
		data() {
			return {
				orderList: []
			}
		},
		methods: {
			async getOrderListByUserId() {
				console.log('根据userId获取订单列表' + this.userId)
				await wx.request({
					url: 'http://127.0.0.1:8080/order/my/list?userId=' + this.userId,
					method: 'GET',
					success: (res) => {
						console.log(res.data)
						this.orderList = res.data
					}
				})

			}
		},
		onLoad() {
			this.getOrderListByUserId()
		}
	}
</script>

<style lang="scss">

</style>